
<template>
  <div id="app">
    <el-container class="layout-container">
      <el-aside width="200px" class="layout-aside">
        <div class="logo">
          <h3>冷链管控系统</h3>
        </div>
        <el-menu
          :default-active="$route.path"
          router
          background-color="#304156"
          text-color="#bfcbd9"
          active-text-color="#409EFF"
        >
          <el-menu-item index="/dashboard">
            <el-icon><Monitor /></el-icon>
            <span>风险预警大屏</span>
          </el-menu-item>
          <el-menu-item index="/procurement">
            <el-icon><ShoppingCart /></el-icon>
            <span>采购管理</span>
          </el-menu-item>
          <el-menu-item index="/warehouse">
            <el-icon><House /></el-icon>
            <span>仓储管理</span>
          </el-menu-item>
          <el-menu-item index="/cold-chain">
            <el-icon><Van /></el-icon>
            <span>冷链运输</span>
          </el-menu-item>
          <el-menu-item index="/store">
            <el-icon><Shop /></el-icon>
            <span>门店管理</span>
          </el-menu-item>
          <el-menu-item index="/inventory">
            <el-icon><Box /></el-icon>
            <span>库存盘点</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      
      <el-container>
        <el-header class="layout-header">
          <div class="header-title">{{ $route.meta.title || '冷链管控系统' }}</div>
          <div class="header-user">
            <el-dropdown>
              <span class="el-dropdown-link">
                管理员<i class="el-icon-arrow-down el-icon--right"></i>
              </span>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item>个人中心</el-dropdown-item>
                  <el-dropdown-item divided>退出登录</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </el-header>
        
        <el-main class="layout-main">
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import { Monitor, ShoppingCart, House, Van, Shop, Box } from '@element-plus/icons-vue'
</script>

<style>
* {
  margin: 0;
  padding: 0;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
}

.layout-container {
  height: 100vh;
}

.layout-aside {
  background-color: #304156;
}

.logo {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  border-bottom: 1px solid #434a50;
}

.layout-header {
  background-color: white;
  box-shadow: 0 2px 4px rgba(0,0,0,.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.header-title {
  font-size: 18px;
  font-weight: bold;
}

.layout-main {
  background-color: #f5f5f5;
  padding: 20px;
}
</style>
